package com.coffee.wx.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.coffee.wx.entity.business.WxUser;
import com.coffee.wx.mapper.WxUserMapper;
import com.coffee.wx.service.IWxUserService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WxUserServiceImpl extends ServiceImpl<WxUserMapper, WxUser> implements IWxUserService {

    @Resource
    private WxUserMapper userMapper;

    @Override
    public List<WxUser> getList() {
//        return userMapper.geList();
        return list();
    }

    @Override
    public WxUser getInfoByOpenId(String openId) {
        return this.getOne(Wrappers.lambdaQuery(WxUser.class)
                .eq(WxUser::getOpenId, openId)
                .last("limit 1"));
    }

}
